Skip to content

Fix racy tests sharing tests/data.out - #101

Merged
kjdev merged 1 commit into
kjdev:masterfrom
skilld-labs:php86-parallel
Aug 12, 2026
Merged

Fix racy tests sharing tests/data.out#101
kjdev merged 1 commit into
kjdev:masterfrom
skilld-labs:php86-parallel

Conversation

@andypost

@andypost andypost commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

streams_001, streams_002 and streams_004 all write, stat and unlink the very same file tests/data.out. Since php-src php/php-src@1d2ea5ce22c ("Run tests in parallel by default", GH-22939, first released in php-8.6.0beta1) run-tests.php spawns min(nproc, 10) workers by default, so these three tests race each other and fail intermittently - filesize()/file_get_contents() hit a path a sibling test has just unlinked.

Give each test its own scratch file, the way tests/dictionary_streams.phpt already does.

Summary by CodeRabbit

  • Tests
    • Updated stream test output files to use unique, test-specific filenames.
    • Prevented multiple tests from sharing and potentially overwriting the same output file.

streams_001, streams_002 and streams_004 all write, stat and unlink the very
same file tests/data.out. Since php-src 1d2ea5ce22c ("Run tests in parallel by
default", GH-22939, first released in php-8.6.0beta1) run-tests.php spawns
min(nproc, 10) workers by default, so these three tests race each other and
fail intermittently - filesize()/file_get_contents() hit a path a sibling test
has just unlinked.

Give each test its own scratch file, the way tests/dictionary_streams.phpt
already does.
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 76cb7a9c-f533-43c1-97cd-7dfba3fff2a3

📥 Commits

Reviewing files that changed from the base of the PR and between f761b4b and 5d988e7.

📒 Files selected for processing (3)
  • tests/streams_001.phpt
  • tests/streams_002.phpt
  • tests/streams_004.phpt

📝 Walkthrough

Walkthrough

The stream tests now write output to files derived from their test filenames instead of using the shared data.out path.

Changes

Stream test output isolation

Layer / File(s) Summary
Use test-specific output files
tests/streams_001.phpt, tests/streams_002.phpt, tests/streams_004.phpt
The tests now derive output paths from their filenames instead of using the fixed data.out path.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: fixing race conditions caused by tests sharing tests/data.out.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kjdev
kjdev merged commit f2c0ff7 into kjdev:master Aug 12, 2026
200 of 202 checks passed
@andypost
andypost deleted the php86-parallel branch August 13, 2026 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants